package com.cloudcc.mobile.dao.impl;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.cloudcc.mobile.AppContext;
import com.cloudcc.mobile.dao.RenWuDao;
import com.cloudcc.mobile.util.NetWork;
import com.cloudcc.mobile.util.Tools;
import com.cloudcc.mobile.util.UrlTools;
public class RenWuDaoImpl implements RenWuDao{
	/*带权限的插入数据*/
	public String insertEvent(String data) {
		String url="";
		String jsonString="";
		try {
			String Data= URLEncoder.encode(data, "utf-8");//这个是对json数据转编码，必须的
			url=UrlTools.url+UrlTools.url_path+"serviceName=insert&objectApiName=Event&data=["+Data+"]&binding="+AppContext.binding;
			jsonString=NetWork.get(url);
		} catch (UnsupportedEncodingException e) {
			Tools.handle(e);
		}
		return jsonString;
	}
	/*带权限的插入任务数据*/
	public String insertTask(String data) {
		String url="";
		String jsonString="";
		try {
			String Data= URLEncoder.encode(data, "utf-8");//这个是对json数据转编码，必须的
			url=UrlTools.url+UrlTools.url_path+"serviceName=insert&objectApiName=Task&data=["+Data+"]&binding="+AppContext.binding;
			jsonString=NetWork.get(url);
		} catch (UnsupportedEncodingException e) {
			Tools.handle(e);
		}
		return jsonString;
	}

}
